﻿<Window x:Class="FluentViewModel.TestApplication.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:fvm="clr-namespace:FluentViewModel;assembly=FluentViewModel"
        xmlns:demo="clr-namespace:FluentViewModel.Demo;assembly=FluentViewModel.DemoCore"
        DataContext="{fvm:ViewModelActivator Type={x:Type demo:IDemoViewModel}}"
        Title="{Binding Path=Title}"
        Height="350"
        Width="525">
    <!--<Window.DataContext>
        <fvm:ViewModelActivator Type="{x:Type demo:IDemoViewModel}"/>
    </Window.DataContext>-->
    <StackPanel Orientation="Vertical">
        <StackPanel.Resources>
            <DataTemplate DataType="{x:Type ValidationError}">
                <TextBlock FontStyle="Italic"
                            Foreground="Red"
                            HorizontalAlignment="Right"
                            Margin="0,1"
                            Text="{Binding Path=ErrorContent}" />
            </DataTemplate>
        </StackPanel.Resources>
        <TextBox x:Name="Text"
                    Height="30"
                    Text="{Binding Path=Text, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}"
                    Validation.ErrorTemplate="{x:Null}"/>
        <ContentPresenter Content="{Binding ElementName=Text, Path=(Validation.Errors).CurrentItem}" />
        <Button Height="30"
                Command="{Binding Path=Command}" />
        <TextBlock Height="30"
                    Text="{Binding Path=Counter}" />
    </StackPanel>
</Window>